package com.bph.commons.utils;


public class TotalDays {
    //月总天数
    public static int totalDays(int month, int year) {
        //一年中平月的天数集合
        int[] imonths = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        String[] smonths = {"January", "February", "March", "April", "May", "June",
                "July", "August", "September", "October", "November", "December"};

        //如果是闰年，二月加一天
        if(isLeapYear(year)) imonths[1]++;
        return imonths[month-1];
    }

    //判定闰年
    public static boolean isLeapYear(int year) {
        return (year % 4 == 0 && year % 100 != 0 || year % 400 == 0);
    }
}
